<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>component-2 props,父组件传值到子组件</title>
    <script src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>component-2 props,父组件传值到子组件</h1>
    <hr/>
    <div id="app">
        <!--这里是属性绑定.把父组件的location绑定到子组件的属性上-->
        <superbone :here='location'></superbone>
    </div>

    <script>

        var app = new Vue({
            el: '#app',
            data: {
                location: '湖北'
            },
            //这里指定的是局部组件.只会在当前的vue实例中出现
            components: {
                superbone: {
                    template: `<div style="color:green">我是局部的superbone组件,我来自{{here}}</div>`,
                    //使用props接收属性上绑定值.props是数组类型
                    props: ['here']
                }
            }
        });
    </script>

</body>
</html>